#ifndef __H_ACCEPTOR_H__
#define __H_ACCEPTOR_H__
#include "Public.h"
#include "Channel.h"

namespace liu
{
	class Eventloop;

	class Acceptor
	{
	public:
		using NewConnectionCallback = function<void(int sockfd)>;
	public:
		Acceptor(Eventloop* pLoop);
		~Acceptor();
	public:
		void SetNewConnCb(const NewConnectionCallback& cb)
		{
			RUN_TRACE;
			m_newConnCabllback = cb;
		}
	public:
		void handleRead();
		void listen();

	public:
		Eventloop*				m_pLoop;
		int						m_sockfd;
		Channel					m_acceptChannel;
		NewConnectionCallback	m_newConnCabllback;
	};

}




#endif // __H_ACCEPTOR_H__